#include <thread>
#include <iostream>
#include <vector>
using namespace std;

void subThread() {
  cout << "sbuThread " << endl;
}

int main() {
  int thread_num = 8;

  vector<thread> threads(thread_num);

  auto begin = threads.begin();
  auto end = threads.end();
  while(begin != end) {
    *begin = thread(subThread);
    ++begin;
  }

  begin = threads.begin();
  while(begin != end) {
    begin->join();
    ++begin;
  }

  return 0;
}
